<%= javascript_include_tag "prototype" %>
<%= javascript_include_tag "util" %>
<%= javascript_include_tag "calendar" %>
<script type="text/javascript">
        function checkNum(flag, msg_id, obj_name, msg_text){
                if (flag) {
                        if ($(obj_name).value == "" || ! digCheck($(obj_name).value))
                        {
                                $(msg_id).innerText = msg_text;
                                $(msg_id).style.display = "block";
                                return false;
                        }
                        else return true;
                }
                else {
                        $(msg_id).style.display = "none";
                }
        }
        function checkDate()
        {
                return checkNum(true,'id_codeCount','code_codeCount','数量输入错误')
                       && checkNum(true,'id_prefix','code_prefix','前缀输入错误')
                       && checkNum(true,'id_fromNum','code_fromNum','起始编号输入错误')
                       && checkNum(true,'id_postfix','code_postfix','后缀输入错误')
        }

</script>
<h1>订单管理 - <span id="secondHeading">填写条形码</span></h1>
<%=form_tag({}, :id=>"input-form" )%>
生成<input id="code_codeCount" type="text" name="codeCount" value="<%=@item.current_count - @item.codeCount%>" size="5" maxlength="20" onfocus ="checkNum(false,'id_codeCount')" onblur="checkNum(true,'id_codeCount',this.id,'数量输入错误')">个条形码 <div class="redNsg" id="id_codeCount" style="display:none;"></div>
<TABLE border="0" id="INPUT_TABLE">
	<%=hidden_field_tag(:salePaperItemId,@item.id)%>
	<%=hidden_field_tag(:agent,@agent)%>
	<%=hidden_field_tag(:agentId,@agentId)%>
	<TR>
		<TD width="20%">前缀</TD>
		<TD><input id="code_prefix" type="text" name="prefix" size="30" maxlength="20" onfocus ="checkNum(false,'id_prefix')" onblur="checkNum(true,'id_prefix',this.id,'前缀输入错误')"/> <div class="redNsg" id="id_prefix" style="display:none;"></div></TD>
	</TR>
	<TR>
		<TD>起始编号</TD>
		<TD><input id="code_fromNum" type="text" name="fromNum" size="30" maxlength="20" onfocus ="checkNum(false,'id_fromNum')" onblur="checkNum(true,'id_fromNum',this.id,'起始编号输入错误')"/> <div class="redNsg" id="id_fromNum" style="display:none;"></div></TD>
        </TR>
	<TR>
		<TD>后缀</TD>
		<TD><input id="code_postfix" type="text" name="postfix" size="30" maxlength="20" onfocus ="checkNum(false,'id_postfix')" onblur="checkNum(true,'id_postfix',this.id,'后缀输入错误')"/> <div class="redNsg" id="id_postfix" style="display:none;"></div></TD>
	</TR>
        <TR>
		<TD colspan="2" align="right"><input type="submit" class="sub" value="生成" onclick="javascript:return checkDate();"></TD>
	</TR>
</TABLE>
<%=end_form_tag%>
